﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PowerControl
{
    public class FriisPropagationModel : PropagationModel
    {
        #region PropagationModel Members

        //Return Transmitting Power from A to B
        //This is just the basic Friis formula
        public double getReceivedPower(Antenna a, Antenna b, double Frequency)
        {
            double d = a.getDistanceFrom( b );
            double ptx =    a.TransmittingPower * Utils.dBToWatt(a.Gain) * Utils.dBToWatt(b.Gain) *
                            Math.Pow( (Utils.frequencyToWavelength(Frequency)/(4.0d * Math.PI * d)), 2.0d );
            return ptx;
        }

        #endregion
    }
}
